package com.example.tool.controller.entity;

import lombok.Data;

@Data
public class HttpResponse<T> {
    public static String SUCCESS_CODE = "000000";
    public static String FAIL_CODE = "999999";
    private T data;
    private String code;
    private String message;

    public static <T> HttpResponse success(T data) {
        HttpResponse response = new HttpResponse();
        response.setData(data);
        response.setCode(SUCCESS_CODE);
        return response;
    }

    public static <T> HttpResponse fail(String message) {
        HttpResponse response = new HttpResponse();
        response.setMessage(message);
        response.setCode(FAIL_CODE);
        return response;
    }
}
